cmake_minimum_required(VERSION 3.19)
project(test LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Qt6 6.5 REQUIRED COMPONENTS Core Widgets Multimedia)

qt_standard_project_setup()

qt_add_executable(test
    WIN32 MACOSX_BUNDLE
    main.cpp
    mainwindow.cpp
    mainwindow.h
    mainwindow.ui
    audiocapturer.h
    audiocapturer.cpp
    spectrumanalyzer.h
    spectrumanalyzer.cpp
    spectrumwidget.h
    spectrumwidget.cpp
)

target_link_libraries(test
    PRIVATE
        Qt::Core
        Qt::Widgets
        Qt::Multimedia
        ole32
        oleaut32
        winmm
        ksuser
)

include(GNUInstallDirs)

install(TARGETS test
    BUNDLE  DESTINATION .
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)

qt_generate_deploy_app_script(
    TARGET test
    OUTPUT_SCRIPT deploy_script
    NO_UNSUPPORTED_PLATFORM_ERROR
)
install(SCRIPT ${deploy_script})
